package org.dromara.xxmj.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.domain.R;
import org.dromara.common.web.core.BaseController;
import org.dromara.xxmj.domain.dto.ExerciseSubmitDto;
import org.dromara.xxmj.domain.dto.GetQuestionListDTO;
import org.dromara.xxmj.domain.dto.SimulationSubmitDTO;
import org.dromara.xxmj.domain.vo.CourseGeneralVO;
import org.dromara.xxmj.domain.vo.CourseVideoVo;
import org.dromara.xxmj.domain.vo.UserCollectQuestionInfoVO;
import org.dromara.xxmj.domain.vo.UserErrorQuestionInfoVO;
import org.dromara.xxmj.service.XxmjAdminService;
import org.dromara.xxmj.service.XxmjExercisesService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 客户端控制器
 *
 * @author WANG CHEN FENG
 */
@Slf4j
@SaIgnore
@RequiredArgsConstructor
@RestController
@RequestMapping("/manage")
public class XxmjAdminController extends BaseController {

    @Resource
    private XxmjAdminService xxmjAdminService;

    /**
     * 章节列表
     *
     * @Author 王晨沣 2307105054
     * @Date 2025-05-29 15:55:30
     */
    @Operation(summary = "章节视频列表")
    @PostMapping("/chapterVideoList")
    public R<List<CourseVideoVo>> chapterVideoList(@Parameter(description = "课程ID (默认为1)") @PathVariable String courseId) {
        List<CourseVideoVo> list = xxmjAdminService.chapterVideoList(courseId);
        return R.ok(list);
    }

//    /**
//     * 错题本列表
//     * @Author 王晨沣 2307105054
//     * @Date 2025-05-21 16:23:29
//     */
//    @Operation(summary = "获取错题本详情")
//    @GetMapping("/getDetailList/{stuId}")
//    public R<List<UserErrorQuestionInfoVO>> getDetailList(@Parameter(description = "学生ID") @PathVariable String stuId) {
//        List<UserErrorQuestionInfoVO> list = xxmjExercisesService.getDetailList(stuId);
//        return R.ok(list);
//    }
//
//    /**
//     * 错题本提交答案
//     * @Author 王晨沣 2307105054
//     * @Date 2025-05-21 16:23:29
//     */
//    @Operation(summary = "提交错题答案")
//    @PostMapping("/detailSubmit")
//    public R<Boolean> detailSubmit(@RequestBody @Valid ExerciseSubmitDto dto) {
//        xxmjExercisesService.detailSubmitAnswer(dto);
//        return R.ok("提交成功");
//    }
//
//    /**
//     * 删除错题
//     * @Author 王晨沣 2307105054
//     * @Date 2025-05-21 16:23:29
//     */
//    @Operation(summary = "删除错题")
//    @PostMapping("/delete/{indexflag}")
//    public R<Boolean> delete(@Parameter(description = "错题索引") @PathVariable Integer indexflag) {
//        xxmjExercisesService.delete(indexflag);
//        return R.ok("删除成功");
//    }
//
//    /**
//     * 收藏库列表
//     * @Author 王晨沣 2307105054
//     * @Date 2025-05-21 16:23:29
//     */
//    @Operation(summary = "获取收藏库列表")
//    @GetMapping("/getCollectList/{stuId}")
//    public R<List<UserCollectQuestionInfoVO>> getCollectList(@Parameter(description = "学生ID") @PathVariable String stuId) {
//        List<UserCollectQuestionInfoVO> list = xxmjExercisesService.getCollectList(stuId);
//        return R.ok(list);
//    }
//
//    /**
//     * 添加收藏库列表
//     * @Author 王晨沣 2307105054
//     * @Date 2025-05-21 16:23:29
//     */
//    @Operation(summary = "添加收藏库列表")
//    @PostMapping("/addCollect/{stuId}/{questionId}/{questionType}")
//    public R<Boolean> addCollect(@Parameter(description = "学生ID") @PathVariable String stuId,
//                                 @Parameter(description = "题目ID") @PathVariable Integer questionId,
//                                 @Parameter(description = "题目类型") @PathVariable Integer questionType) {
//        xxmjExercisesService.addCollect(stuId, questionId,questionType);
//        return R.ok("添加成功");
//    }
//
//    /**
//     * 取消收藏
//     * @Author 王晨沣 2307105054
//     * @Date 2025-05-21 16:23:29
//     */
//    @Operation(summary = "取消收藏")
//    @PostMapping("/cancelCollect/{id}")
//    public R<Boolean> cancelCollect(@Parameter(description = "收藏索引") @PathVariable Integer id) {
//        xxmjExercisesService.cancelCollect(id);
//        return R.ok();
//    }
//
//    /**
//     * 提交模拟卷答案
//     * @Author 王晨沣 2307105054
//     * @Date 2025-05-22 14:20:41
//     */
//    @Operation(summary = "提交模拟卷答案")
//    @PostMapping("/submitSimulation")
//    public R<Boolean> submitSimulation(@RequestBody @Validated SimulationSubmitDTO dto) {
//        xxmjExercisesService.submitSimulation(dto);
//        return R.ok("提交成功，批阅试卷中~请稍后...");
//    }


//    /**
//     * 提交习题答案
//     *
//     * @Author 王晨沣 2307105054
//     * @Date 2025-05-21 14:14:48
//     */
//    @Operation(summary = "提交习题答案")
//    @PostMapping("/submit")
//    public R<Boolean> submitAnswer(@RequestBody @Validated XxmjExercisesService.ExerciseSubmitDTO dto) {
//        return R.ok(xxmjExercisesService.submitAnswer(dto));
//    }

//
//    @Operation(summary = "提交模拟试卷答案")
//    @PostMapping("/submitSimulation")
//    public R<Boolean> submitSimulationAnswer(@RequestBody @Validated XxmjExercisesService.ExerciseSubmitDto dto) {
//        return R.ok(xxmjExercisesService.submitSimulationAnswer(dto));
//    }




}
